#include "../../assets/include/bugsnag.h"
#include <jni.h>
#include "thehilog/log.h"
extern "C" {

bool my_on_error_b(void * event) {
    bugsnag_event_set_user(event, "999999", "ndk override", "j@ex.co");
    bugsnag_event_add_metadata_string(event, "Native", "field", "value");
    bugsnag_event_add_metadata_bool(event, "Native", "field", true);
    return true;
}

JNIEXPORT void JNICALL
Java_com_bugsnag_ohos_ExtraTest_performNativeBugsnagSetup(JNIEnv * env, jobject instance) {
    bugsnag_add_on_error(& my_on_error_b);
}

JNIEXPORT void JNICALL
Java_com_bugsnag_ohos_ExtraTest_notifyFromCXX(JNIEnv * env, jobject instance) {
    bugsnag_set_user_env(env, "124323", "joe mills", "j@ex.co");
    bugsnag_leave_breadcrumb_env(env, "Critical failure", BSG_CRUMB_LOG);
    bugsnag_notify_env(env, "Oh no", "The mill!", BSG_SEVERITY_INFO);
}

}